home *** CD-ROM | disk | FTP | other *** search
- ;*******************************************************************
- ;
- ; packhead.asm
- ; ------------
- ;
- ; (c) 1987, 1988 Attic Software
- ;
- ; header and assembly routines for PACK segment of Transfer.
- ;
- ;*******************************************************************
-
- ;*******************************************************************
- ; exported routines
- ;*******************************************************************
-
- xdef setglobal
- xdef getglobal
- xdef runiaz
-
- ;*******************************************************************
- ;
- ; The jump table begins with a jump into the body of the
- ; table, indexed by D0 (the routine selector). Then it
- ; branches to the appropriate routine.
- ;
- ;*******************************************************************
-
- xref initglobals
- xref setdir
-
- jmp 2(PC,D0.w)
- bra.w initglobals
- bra.w setdir
-
- ;*******************************************************************
- ;
- ; The global access routines provide a way to save the address
- ; of the global record, which would otherwise be lost. This
- ; is done by writing the address into a four-byte constant in
- ; the PACK segment.
- ;
- ; Note: writing to code segments is frowned upon in some
- ; circles. This objection has a legitimate basis: self-
- ; modifying code is a horror. It makes debugging difficult,
- ; and maintenance impossible. (5 points: where in “Inside
- ; Mac” are you instructed to write self-modifying code?) In
- ; this instance, I an not modifying code; I am modifying data,
- ; and there's nothing wrong with that.
- ;
- ; procedure setglobal(value : long);
- ; function getglobal : long;
- ;
- ;*******************************************************************
-
- module 'access'
-
- setglobal
- movea.l (SP)+,A0
- lea dummy,A1
- Move.l (SP)+,(A1)
- jmp (A0)
-
- getglobal
- movea.l (SP)+,A0
- Move.l dummy,(SP)
- jmp (A0)
-
- dummy
- dc.w 'xxxx'
-
- ;*******************************************************************
- ;
- ; procedure runiaz(iazaddr : long)
- ;
- ; The runiaz routine zeros the “iaznotify” hook, and calls
- ; the routine that preceded Transfer's routine, if any.
- ;
- ;*******************************************************************
-
- module 'runiaz'
-
- runiaz
- clr.l $33C
- movea.l 4(SP),A0
- Move.l (SP)+,(SP)
-
- cmpa.l #0,A0
- beq.w L0001
- Move.l A0,-(SP)
-
- L0001
- rts
-
- ;*******************************************************************
-